/**
 * @param {string} s1
 * @param {string} s2
 * @return {boolean}
 */
var CheckPermutation = function (s1, s2) {
  let arr1 = s1.split(''), arr2 = s2.split('');
  if (arr1.length !== arr2.length)
    return false;
  arr1.sort();
  arr2.sort();
  for (let i = 0; i < arr1.length; i++) {
    if (arr1[i] !== arr2[i])
      return false;
  }
  return true;
};
console.log(CheckPermutation('abc', 'bca'));